﻿//-----------------------------------------------------------------------
// <copyright file="CustomerValidator.cs" company="FER">
//     Copyright (c) All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace NMBP.View.Validators
{
    using NMBP.Models;

    /// <summary>
    /// Represents validator for cusomer object
    /// </summary>
    public static class CustomerValidator
    {
        /// <summary>
        /// validates customer object
        /// </summary>
        /// <param name="customer">customer to be validated</param>
        public static bool ValidateCustomer(Customer customer)
        {
            if (customer.BankCardNumber.Length != 10)
            {
                return false;
            }

            if (!customer.Contact.Contains("@") || customer.Contact.Length > 20)
            {
                return false;
            }

            if (customer.Name.Length < 5 || customer.Name.Length > 20)
            {
                return false;
            }

            if (customer.Surname.Length < 5 || customer.Surname.Length > 20)
            {
                return false;
            }

            if (customer.Password.Length < 5 || customer.Password.Length > 20)
            {
                return false;
            }

            if (customer.Username.Length < 5 || customer.Username.Length > 20)
            {
                return false;
            }

            return true;
        }
    }
}
